import {simpleGet, simplePost} from "../utils/request";

const areaService = {
    async getAllTree(){
        const app = getApp()
        const tree = app.globalData.areaTreeAll
        if (!tree){
            const {tree} = await simpleGet("/area/getAllTree")
            app.globalData.areaTreeAll = tree
        }
        return tree
    },

    async geocoder(location){
        const {info} = await simplePost("/area/geocoder", {location})
        return info
    }
}

export default areaService
